home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Developer Helper 1: Phil & Dave's Excellent CD
/
Excellent CD HFS.raw
/
Moof
/
Goodies
/
MPW Goodies
/
MPW Goodies⁄DTS
/
CancelWindowCheckOut
< prev
next >
Wrap
Text File
|
2022-08-05
|
2KB
|
71 lines
# CancelWindowCheckOut - revert to an old copy of a checked-out window
#
# Usage: CancelWindowCheckOut window
#
# Status: CancelWindowCheckOut may return the following status values:
#
# 0 the window was reverted
# 1 error
# 4 the user canceled
#
# CancelWindowCheckOut cancels the changes that have been made
# to a file in a window.
#
# © 1988, 1989 Apple Computer, Inc.
# All rights reserved.
Set Exit 0
Set CaseSensitive 0
# the following helps to debug until MPW sends echos to Dev:Console instead of Dev:StdErr
If {Echo} == 1
Set somewhere "∑∑ '{Worksheet}∂'"
Else
Set somewhere '∑ Dev:Null'
End
Begin
Set Window "{1}"
# get short name of window
If "{Window}" !~ /:*([¬:]+:*)*([¬:]+)®1/
Exit 1
End
Set Short "{®1}" # get short name for dialogs
Set Cant "Changes to “{Short}” can’t be discarded"
# check what project the window belongs to
Set Info "`ProjectInfo "{Window}"`"
### If "{Info}" !~ /≈Project: (≈∫)®1 ≈/
If "{Info}" !~ /≈Project: (≈)®1 Checked out: ≈/
Alert "{Cant} because it doesn’t belong to a project."
Exit 1
End
Set Project "{®1}"
# ensure that the window is checked out
If "{Info}" !~ /[¬,]+,[¬ ∂t]+∂+≈/
Alert "{Cant} because it wasn’t checked out."
Exit 1
End
# check if the project is mounted
Set Info "`ProjectInfo -only -project "{Project}"; Set InfoStatus {Status}`"
If {InfoStatus} != 0
Alert "{Cant} because the project “{Project}” is not mounted."
Exit 1
End
# *** what about a way to start over (get a new modifiable)?
# *** in that case, what about introducing a new branch?
CheckOut -project "{Project}" -cancel "{Window}"
Set CheckOutStatus {Status}
Exit {CheckOutStatus}
End {somewhere}